<?php
class Delivery_Model_Mapper_MailsQueue
	extends Delivery_Model_Mapper_Abstract
{
	
	public function getDbTable()
	{
		return parent::getDbTable( 'MailsQueue' );
	}
	
	public function save( $mail )
	{
		$dbTable= $this->getDbTAble();
		
		if ( ! $mail->getId() ){	
			return $mail->idMailQueue = $dbTable->insert( $mail );
		} else {					
			return $dbTable->update( $mail );	
		}	
		
	}
	
	public function delete( $mail )
	{
		$dbTable= $this->getDbTAble();
		
		return $dbTable->delete( $mail );
	}
	
	/**
	 * @return Delivery_Model_Collection_Categorias
	 */
	public function getAll( $limit ){
	
		$dbTable= $this->getDbTAble();
			
		return $this->_fetchCollection(
			'MailsQueue',
			$dbTable->getAll( $limit )
		);
	}	
	
	/**
	 * @param array
	 * @return object Delivery_Model_MailQueue
	 */
	protected function _fetch( $row )
	{
		return new Delivery_Model_MailQueue( $row );;
	}
	
}